package com.suxin.datahub.core.query;

import com.suxin.datahub.core.DataBaseQueryService;

/**
 * @Classname AbstractBaseQueryService
 * @Description [ TODO ]
 * @Author Tang
 * @Date 2020/11/10 9:13
 * @Created by ASUS
 */
public abstract class AbstractBaseQueryService implements DataBaseQueryService {

    @Override
    public String getTables() {
        return "show tables";
    }

    // SELECT * FROM information_schema.`COLUMNS` WHERE TABLE_NAME = 'test01' AND TABLE_SCHEMA = 'test01'

    @Override
    public String getTableColumns(String tableSchema, String tableName) {
        return "select TABLE_SCHEMA AS tableName,COLUMN_NAME AS columnName," +
                "DATA_TYPE AS dataType,IS_NULLABLE AS isNullable from information_schema" +
                ".COLUMNS where TABLE_SCHEMA = '" + tableSchema + "' and " + "TABLE_NAME = '" +
                tableName + "'";
    }
}